so many times when we have a large dataset we have to do something to reduce it simply because the cost efficiency because of the time because of the money so how to get a smaller sample we want we can try with multiple ways here is a dimension elimination approach so basically we can try to reduce the complexity of the data in terms of number of attributes sometimes we may not need that many attributes because when we collect the data we just try to collect as many attributes as possible because we may use it in the future however for certain analysis maybe some of the attributes are not that meaningful maybe some of the attributes must not be in our analysis so the dimension elimination simply drop those unnecessary attributes so that we can have a smaller dimension or we have a much more simpler data set to work with that is the elimination of our attributes of course there are other approaches such as principle component analysis or PCA that is a dimension extraction or feature extraction rather than simply drop some of the attributes we actually blend them and choose the significant blended feature blended component out of the analysis that will be another story we are going to cover that in the unsupervised learning method in our data analysis specialization okay so let's continue with our setup our setup is quite normal we need to import numpy we need to import pandas and then we are going to load our data set this time we're going to use the california_housing_train.CSV the dataset is right in the left bar click on the 3 dots copy the path and paste it to here is how you can get access to another CSV file so after a really quick big picture examination of this CSV file we found out we have 9 attributes and we have 17,000 observations and then we may find out with these 9 attributes we can eliminate some of them and to eliminate the dimensions we can do in 2 approach the first approach is to select only the dimensions we want we select only the features or attributes we want such as in our df_sample1 we are going to select only the attributes from index 2 which means that we are going to eliminate index 0 and index 1 so our longitude and altitude will basically be removed from our df_sample1 and we end up with only 7 attributes we want in the other way is that we want to drop some of the attributes so in this case we can call the df.drop with the df.columns up to index 2 basically we are going to drop columns index 0 and 1 to drop a column we have to call axis equal to 1 because otherwise by default you are dropping rows not dropping columns when you specify axis equal to 1 and drop the specified columns you are going to end up the same 7 attributes in df2_sample but df_sample1 is slicing df_sample2 is dropping and then if the attribute you are going to select are not this nicely you are going to drop the first 2, or you are going to keep the rest of the 7 then you can specify any needed columns as a list each of the element in that list is the name of the columns you want to keep so we just need to choose slicing those needed columns and we get the df_sample3 in which we have 4 columns needed that is total rooms total bedrooms population and households and this 'don'tneeded_cols' will be the columns you don't need you want to drop if you are using drop approach for the drop approach again you just need to call the drop fill in that columns you don't need specify your axis equal to 1 then you are going to get df_sample4 with the housing medium age, total rooms and the total bedrooms, population and households so and so forth basically you can customize the needed columns if you want to do slicing you can customize the don't needed columns if you want to do dropping and if you are certain you want to keep the change in that original dataset basically we learned you have inplace equal to True so you don't have to assign the result to a new data frame you can work directly from the modified original data frame so this will be a really really simple and a straightforward dimension elimination I will see you later